Skip Ribbon Commands
Skip to main content

How to define optional sections in document templates

Optional sections can be a powerful construct in document production, allowing you to create templates whose content changes dramatically according to the particulars of the file, contacts, etc. They also make it easier to omit unnecessary text and markup if the values which populate a section are not present in the document.
 
Presently, optional sections are supported for Microsoft Word (.dotx) templates only.

Microsoft Word (2007 and higher)

ContactsLaw uses Microsoft Word's bookmarks feature to define optional sections within a template. In Word, bookmarks allow you to assign a familiar name to a selection within the document; this selection may span over several paragraphs, tables, lists, etc, making it a very flexibile mechanism.
 
To set a bookmark in Word:
  1. Select an area in the document which represents the optional section.
  2. Click the Insert ribbon tab, then the Bookmark button.
  3. Type a name for the bookmark; the name cannot contain spaces, so mixed casing is preferred.
  4. Click the Add button.

You can view, change or remove existing bookmarks from the same window.

When you have finished editing the template, be sure to click the Reload fields button in ContactsLaw.

On the Optional sections tab in the document template editor, your bookmarks will appear in the grid. Bookmarks in the document which you create for other purposes can be safely ignored here.

To set a condition for a section in the document:

  1. Identify a ContactsLaw field which will determine whether the section is included or not.
  2. Drag or paste the field into the 'Mapping' column beside the name of the bookmark.
  3. Choose a condition to apply to the value from the ContactsLaw field; you can choose from:
    • exists - section is included if the document produces a result for the field
    • doesn't exist - section is included if the document does not produce a result for the field
    • contains - section is included if the result for the field contains a particular word or phrase
    • doesn't contain - section is included if the result for the field doesn't contain a particular word or phrase
    • starts with - section is included if the result for the field starts with a particular word or phrase
    • ends with - section is included if the result for the field ends with a particular word or phrase
    • single result only - section is included if only one result is produced for the field
    • two or more results - section is included if two or more results are produced for the field
    • prompt the user - the user is prompted to choose whether the section is included

Note: If multiple results are produced for a field and the condition is "contains", "starts with" or "ends with", the condition will be regarded as true if any result satisfies the condition. If the condition is "doesn't contain", it will be regarded as true if all results satisfy the condition.